<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j">
	
<body> 
 <ui:composition template="/templates/default/template.xhtml">
    <ui:define name="body">       
    <h:panelGrid columns="1" style="margin-left:5px;width:100%">
    	<!--  tieu de -->
    	<h:panelGrid columns="3" styleClass="columPanelbaritemTitle">
					<h:graphicImage value="/templates/default/images/left-heading_01.jpg" style="margin-left:-4px;margin-bottom:0px"></h:graphicImage>
			  		<h:outputText value="Cập nhật đoàn vào" styleClass="panelbaritemTitle"></h:outputText>
					<h:graphicImage value="/templates/default/images/left-heading_03.jpg"></h:graphicImage>
		 </h:panelGrid>
	  	<!-- ket thuc tieu de -->
		<!-- phan noi dung phia duoi -->	  
    	<h:panelGrid columns="1" styleClass="panelGridBody">
    	<h:form id="xoadoanvao"> 
    			<!-- Bat dau noi dung ben trong -->
		    <rich:panel style="background:#FFFFFF">
		    	<h:panelGrid columns="1" style="margin-left:13px;">
		       		<h:outputText id="idError" value="#{xoaDoanVao.error}" style=" color: red;"></h:outputText>
				</h:panelGrid>		
				<h:panelGrid columns="5" style="margin-left:13px;">
		       	 	<h:outputText value="Mã đoàn(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="text" value="#{xoaDoanVao.maDoan}" size="20">
		    		</h:inputText>
		    		<h:panelGrid columns="1">
						 <rich:suggestionbox  id="suggestionBoxId" for="text" tokens=",["
			                rules="#{suggestionBox.rules}"
			                suggestionAction="#{suggestionBox.autocomplete}" var="result"
			                fetchValue="#{result.text}" rows="#{suggestionBox.intRows}"
			                first="#{suggestionBox.intFirst}"
			                minChars="#{suggestionBox.minchars}"
			                shadowOpacity="#{suggestionBox.shadowOpacity}"
			                border="#{suggestionBox.border}" width="#{suggestionBox.width}"
			                height="#{suggestionBox.height}"
			                shadowDepth="#{suggestionBox.shadowDepth}"
			                cellpadding="#{suggestionBox.cellpadding}">			            
		                <h:column styleClass="inputText">
		                    <h:outputText value="#{result.text}" styleClass="inputText"/>
		                </h:column>
                  </rich:suggestionbox>
                   </h:panelGrid>                   
		    		<a4j:commandButton type="Button" value="Tìm kiếm" styleClass="Button" action="#{xoaDoanVao.displayDoanVao}">
		       		</a4j:commandButton>	
		       		<a4j:commandButton type="Button" value="Hiển thị tấc cả" styleClass="Button" action="#{xoaDoanVao.displayAll}">
		       		</a4j:commandButton>		       	
		    		</h:panelGrid>		    		    	
		</rich:panel>		
		  </h:form>
		  
		   		    <h:panelGrid columns="1" style="margin-left:0px;">		       		
		       		<h:outputText value="Danh sách đoàn vào " styleClass="inputText" ></h:outputText>		       			    		
				</h:panelGrid>
				 
			<!-- Bat dau table -->
					<h:form>
			
					<h:dataTable id="list" value="#{xoaDoanVao.listDoanVao}" var="Item" 
								columnClasses="column" headerClass="TableHeader" rowClasses="ROW1,ROW2" footerClass="TableFooter" 
					       style="width:100%; margin-left:0px;margin-top: 10px" cellspacing="1px;" rows="20">
						
						<h:column >
							<f:facet name="header">
								<h:outputText value="STT"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.stt}"></h:outputText>
							<f:facet name="footer">
								<rich:spacer></rich:spacer>
							</f:facet>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Mã đoàn"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.maDoanVao}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Ngày đến"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.ngayDen}"></h:outputText>
						</h:column>
							<h:column>
							<f:facet name="header">
								<h:outputText value="Ngày đi"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.ngayDi}"></h:outputText>
						</h:column>
							<h:column>
							<f:facet name="header">
								<h:outputText value="Địa điểm làm việc"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.diaDiemLamViec}"></h:outputText>
						</h:column>
							<h:column>
							<f:facet name="header">
								<h:outputText value="Cơ quan đề nghi đến"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.coQuanDeNghi}"></h:outputText>
						</h:column>			
						<h:column>
							<f:facet name="header">
								<h:outputText value="Xóa"></h:outputText>
							</f:facet>
							<a4j:commandLink action="#{xoaDoanVao.delete}"  onclick="if(!confirm('Bạn muốn xóa đoàn ra này?')) 
							 								{return false;}" reRender="idError">
							 	<h:graphicImage value="/qldoanra/func01/images/icoDelete.gif">
							 	</h:graphicImage>
							 	<f:param value="#{Item.maDoanVao}" name="maDoan"/>							 
							 </a4j:commandLink>
						</h:column>
					</h:dataTable>
						<!-- phan trang -->
						<rich:datascroller align="right"  for="list" maxPages="20" />
						<!-- ket thuc phan trang -->
				</h:form>
    </h:panelGrid>
   </h:panelGrid>
  
 </ui:define>
</ui:composition> 
</body>	
</html>